<?php/*  PHP version 5  Copyright (c) 2002-2019ECISP.CN、EarcLink.COM  警告：这不是一个免费的软件，请在许可范围内使用，请尊重知识产权，侵权必究，举报有奖  作者：黄祥云 E-mail:6326420@qq.com  QQ:6326420 TEL:18665655030 / 13797552220*/


namespace modul_application;

class ESPCMS_Dialog {

    public static function Message_Page($lngpack_name = false, $submit_link = false, $submit_button_name_code = false, $back_button_name_code = false, $back_link = false, $format_code = array()) {
        global $espcms_web_templates, $espcms_command;
        if (!$lngpack_name || !preg_match('/^[\w]+$/', $lngpack_name)) {
            espcms_message_err('public_pack-espcms_input_parameter_fail', array($lngpack_name));
        }
        $link = $submit_link ? $submit_link : $_SERVER['HTTP_REFERER'];
        $lanpack = $espcms_web_templates->geto('lngpack');
        if (!$lanpack[$lngpack_name]) {
            espcms_message_err('public_pack-espcms_input_parameter_fail', array($lngpack_name));
        }
        $submit_button_name = !$submit_button_name_code && !preg_match('/^[\w]+$/', $submit_button_name_code) ? $lanpack['goback_botton'] : $lanpack[$submit_button_name_code];
        if (preg_match('/^[\w]+$/', $back_button_name_code)) {
            $back_button_name = $lanpack[$back_button_name_code];
        }
        if (isset($lanpack[$lngpack_name]) && !empty($lanpack[$lngpack_name]) && is_array($format_code) && count($format_code) > 0) {

            $lanpack[$lngpack_name] = vsprintf($lanpack[$lngpack_name], $format_code);
        }
        $espcms_web_templates->into('tip_message', $lanpack[$lngpack_name]);
        $espcms_web_templates->into('tip_time', $espcms_command['TIP_SEARCHTIME']);
        $espcms_web_templates->into('submit_button_name', $submit_button_name);
        $espcms_web_templates->into('submit_link', $link);
        $espcms_web_templates->into('back_button_name', $back_button_name);
        $espcms_web_templates->into('back_link', $back_link);
        $espcms_web_templates->output('public/callmessage', 'callmessage', false, false);
        exit;
    }

    public static function Message_len_Page($tip_message = false, $submit_link = false, $submit_button_name_code = false, $back_button_name_code = false, $back_link = false) {
        global $espcms_web_templates, $espcms_command;
        $link = $submit_link ? $submit_link : $_SERVER['HTTP_REFERER'];
        $lanpack = $espcms_web_templates->geto('lngpack');
        $submit_button_name = !$submit_button_name_code && !preg_match('/^[\w]+$/', $submit_button_name_code) ? $lanpack['goback_botton'] : $lanpack[$submit_button_name_code];
        if (preg_match('/^[\w]+$/', $back_button_name_code)) {
            $back_button_name = $lanpack[$back_button_name_code];
        }
        $espcms_web_templates->into('tip_message', $tip_message);
        $espcms_web_templates->into('tip_time', $espcms_command['TIP_SEARCHTIME']);
        $espcms_web_templates->into('submit_button_name', $submit_button_name);
        $espcms_web_templates->into('submit_link', $link);
        $espcms_web_templates->into('back_button_name', $back_button_name);
        $espcms_web_templates->into('back_link', $back_link);
        $espcms_web_templates->output('public/callmessage', 'callmessage', false, false);
        exit;
    }

}
